<template>
  <div class="boxs">
    <img src="@/assets/shangpiao/组162.png" alt="" />
    <h3>
      用信申请提交成功，请下载
      <i
        v-if="productcode == 'SCF012002'"
        @click="getPdfFile"
        style="
          color: blue;
          text-decoration: underline;
          cursor: pointer;
          background: #fff;
          margin-top: 20px;
        "
      >
        《应收账款信息确认函》</i
      >
      <i
        v-if="productcode == 'SCF012003'"
        @click="getPdfFile"
        style="
          color: blue;
          text-decoration: underline;
          cursor: pointer;
          background: #fff;
          margin-top: 20px;
        "
      >
        《应收账款确认凭证》</i
      >
    </h3>
    <PreViewPage v-if="PreViewPageStatus" style="position: absolute; top: 0; z-index: -99" />
    <PreViewPageVoucher v-if="PreViewPageStatus" style="position: absolute; top: 0; z-index: -99" />
  </div>
</template>

<script>
import PreViewPage from '@/components/PreViewPage.vue'
import PreViewPageVoucher from '@/components/voucher/PreViewPage.vue'

import { myPostFetch } from '@/utils'
export default {
  components: { PreViewPage, PreViewPageVoucher },
  data() {
    return {
      productcode: localStorage.getItem('productcode'),
      showVisible: false,
      userData: null,
      formList: [],
      PreViewPageStatus: false
    }
  },
  mounted() {},
  methods: {
    getPdfFile() {
      this.formList = []
      this.getFindputoutGCFile(localStorage.getItem('putoutid'))
      this.PreViewPageStatus = true
      if (localStorage.getItem('productcode') == 'SCF012002') {
        setTimeout(() => {
          this.exportToPdf(
            'pdfDom',
            '应收账款信息确认函',
            'ConfirmedAccDetail-demo',
            localStorage.getItem('putoutid')
          )
        }, 1000)
      } else if (localStorage.getItem('productcode') == 'SCF012003') {
        setTimeout(() => {
          this.exportToPdf(
            'pdfDomFK',
            '应收账款确认凭证',
            'ConfirmedAccDetail-demo',
            localStorage.getItem('putoutid')
          )
        }, 1000)
      }
      setTimeout(() => {
        this.$router.go(0)
      }, 2000)
    },
    async getFindputoutGCFile(putoutid) {
      let url = '/api/pros/findfilelist'
      let params = {
        putoutid: putoutid
      }
      let data = await myPostFetch(url, params)
      this.formList.push({
        a: data.data.contractno,
        b: data.data.contractname,
        c: data.data.billno,
        d: data.data.billcode,
        e: data.data.payamount,
        f: data.data.paydate,
        g: data.data.acctname,
        h: data.data.acctno,
        i: data.data.bank
      })
      localStorage.setItem('putoutid', putoutid)
      localStorage.setItem('orgname', data.data.orgname)
      // localStorage.setItem('inputdate', data.data.inputdate)
      localStorage.setItem('formList', JSON.stringify(this.formList))
    }
  }
}
</script>

<style lang="scss" scoped>
.boxs {
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 2.0833rem;
  overflow: hidden;
  img {
    width: 1.6979rem;
    height: 1.1042rem;
  }
  h3 {
    font-size: 0.0833rem;
    font-family: Source Han Sans SC;
    font-weight: 400;
    color: #b3b3b3;
  }
}
// 弹出框
.dialog-center {
  box-sizing: border-box;
  padding: 0 0.026rem;
  display: flex;
  justify-content: center;
  width: 100%;
  // 小屏
  @media only screen and (min-width: 900px) and (max-width: 1535px) {
    height: 3.05rem;
  }
  // 中屏
  @media only screen and (min-width: 1536px) and (max-width: 1919px) {
    height: 2.8rem;
  }
  // 大屏
  @media only screen and (min-width: 1920px) and (max-width: 2580px) {
    height: 3.4375rem;
  }
  .first {
    display: flex;
    justify-content: center;
    align-items: center;
    // 小屏
    @media only screen and (min-width: 900px) and (max-width: 1535px) {
      min-width: 3.125rem;
      height: 2.3958rem;
    }
    // 中屏
    @media only screen and (min-width: 1536px) and (max-width: 1919px) {
      width: 3.125rem;
      height: 2.3958rem;
    }
    // 大屏
    @media only screen and (min-width: 1920px) and (max-width: 2580px) {
      width: 3.9583rem;
      height: 3.0208rem;
    }

    background-color: #fff;

    h1 {
      font-size: 0.0938rem;
    }
  }
}

.dialog-footer {
  display: flex;
  justify-content: space-evenly;
  width: 70%;
  margin: 0 auto;
  .dialog-footer-bnt {
    width: 0.6302rem;
    height: 0.1615rem;
    color: #3f6ef2;
    border: 0.0052rem solid #3f6ef2;
    border-radius: 0.0208rem;
    background-color: #fff;
  }
  .btn2 {
    color: #fff;
    background-color: #3f6ef2;
    &.actives {
      background-color: rgba(10, 123, 224, 0.6);
      border: 0px;
    }
    &.activess {
      background-color: rgba(94, 95, 95, 0.6);
      border: 0px;
    }
  }
}
.abc {
  width: 1.9167rem;
  .el-select {
    width: 100%;
  }
}
.dialog-center-hint {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 0.1042rem;
  font-size: 0.0885rem;
}
// 协议
::v-deep .inviteAffirmClient .el-dialog {
  // 小屏
  @media only screen and (min-width: 900px) and (max-width: 1535px) {
    width: 55%;
    // background-color: #f0f;
  }
  // 中屏
  @media only screen and (min-width: 1536px) and (max-width: 1919px) {
    width: 55%;
    // background-color: #ff0;
  }
  // 大屏
  @media only screen and (min-width: 1920px) and (max-width: 2580px) {
    width: 60%;
    // background-color: #f00;
  }
}
</style>
